<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位水平垂直居中</title>
    <style>
        .box{
            position: absolute;
            left: 50%;
            margin-left: -200px;
            top: 50%;
            margin-top: -200px;
            width: 400px;
            height: 400px;
            background-color: skyblue;
            display: flex;
        }
        .text{
            width: 200px;
            height: 200px;
            background: red;
            margin: auto;
            display: flex;
        }
        .l{
            width: 100px;
            height: 100px;
            background: blue;
            margin: auto;
        }
    </style>
</head>
<body>
    <div class="box">

        <div class="text">
            <div class="l">

            </div>
        </div>
    </div>
</body>
</html>